<template>
  <div>
        <el-form
          :model="queryParams"
          ref="queryForm"
          :inline="true"
          label-width="68px"
          @submit.native.prevent
        >
          <el-form-item label="批次名称" prop="batchName">
            <el-input
              v-model="queryParams.batchName"
              placeholder="模糊查询"
              clearable
              size="small"
              style="width: 240px"
              @keyup.enter.native="selectDiscuss"
            />
          </el-form-item>
          <el-form-item label="课程名称" prop="courseName">
            <el-input
              v-model="queryParams.courseName"
              placeholder="模糊查询"
              clearable
              size="small"
              style="width: 240px"
              @keyup.enter.native="selectDiscuss"
            />
          </el-form-item>
          <el-form-item label="学生姓名" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="模糊查询"
              clearable
              size="small"
              style="width: 240px"
              @keyup.enter.native="selectDiscuss"
            />
          </el-form-item>

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="selectDiscuss"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <el-table v-loading="loading" :data="certificateList">
          <!-- <el-table-column type="selection" width="50" align="center" /> -->
          <el-table-column label="id" align="center" key="id" prop="id" />
          <el-table-column
            label="节点ID"
            align="center"
            key="nodeId"
            prop="nodeId"
          />
          <el-table-column
            label="排序码"
            align="center"
            key="sortCode"
            prop="sortCode"
          />
          <el-table-column
            label="评价内容"
            align="center"
            key="data"
            prop="data"
          />
          <el-table-column
            label="父节点"
            align="center"
            key="parentId"
            prop="parentId"
          />
          <el-table-column
            label="评价时间"
            align="center"
            key="createTime"
            prop="createTime"
            width="160"
          >
          </el-table-column>
        </el-table>

        <!-- 分页 -->
        <pagination
          v-show="this.sum > 0"
          :total="this.sum"
          :page.sync="queryParams.page"
          :limit.sync="queryParams.number"
          @pagination="selectDiscuss"
        />      
  </div>
</template>

<script>
import {
  selectDiscussApi
} from "@/api/system/discuss";
export default {
  name: "discuss",
  // components: { Treeselect },
  data() {
    return {
      // 遮罩层
      loading: true,
      loadingBatch: true,
      refreshTable: true,
      // 导出遮罩层
      exportLoading: false,
      // 学院表格数据
      certificateList: [],
      sum: 0,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 状态数据
      form: {},
      //   collegeId: undefined,
      // 查询参数
      queryParams: {
        page: 1,
        number: 10,
        name: undefined,
      },
      // // 列信息
      columns: [
        { key: 0, label: `批次编号`, visible: true },
        { key: 1, label: `批次名称`, visible: true },
        { key: 2, label: `状态`, visible: true },
        { key: 3, label: `创建时间`, visible: true },
      ],
      // 表单校验
      rules: {},
      dialogTableVisible: false
    };
  },
  watch: {},
  created() {
    this.selectDiscuss();
  },
  methods: {
    //查询评论
    selectDiscuss() {
      selectDiscussApi(this.queryParams)
        .then((data) => {
          this.certificateList = data.data;
          console.log(certificateList);
          this.sum = data.data.paginationData.sum;
          this.loading = false;
        })
        .catch(() => {
          this.certificateList = [];
          this.sum = 0;
          this.loading = false;
        });
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        name: undefined,
        code:undefined,
        startDate:undefined,
        endDate:undefined,
        status:undefined
      };
       if (this.$refs["form"]) {
		    this.$refs["form"].resetFields();
	    }
    },
    /** 重置按钮操作 */
    resetQuery() {
      if (this.$refs["queryForm"]) {
        this.$refs["queryForm"].resetFields();
      }
      this.selectBatch();
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
  },
};
</script>